package com.xlh.pojo.system;

import lombok.Data;

import java.time.LocalDateTime;

/**
 * 图片验证码
 * <p>
 * Created by lx on 2019/1/25.
 */
@Data
public class ImageCode {

    /**
     * 验证码
     */
    private String code;

    /**
     * 过期时间
     */
    private LocalDateTime expireTime;

    public ImageCode(String code, int expireIn) {
        this.code = code;
        this.expireTime = LocalDateTime.now().plusSeconds(expireIn);
    }

    public boolean isExpired() {
        return LocalDateTime.now().isAfter(expireTime);
    }

}
